import sys,os  
import ConfigParser
class Db_Connector:  
    def __init__(self, config_file_path):
        global db_host,db_port,db_user,db_pwd,db_name
        cf = ConfigParser.ConfigParser()  
        cf.read(config_file_path)
        db_host = cf.get("baseconf", "host")  
        db_port = cf.getint("baseconf", "port")  
        db_user = cf.get("baseconf", "user")  
        db_pwd = cf.get("baseconf", "password") 
        db_name = cf.get("baseconf", "db_name") 
    #print db_host, db_port, db_user, db_pwd 
    def get_host(self):
        return db_host
    
    def get_db_port(self):
        return db_port
    
    def get_db_user(self):
        return db_user
    
    def get_db_pwd(self):
        return db_pwd
    
    def get_dbname(self):
        return db_name

class Api_connect:  
    def __init__(self, file_path):
        global url_path,api_key,db_user,sec_Key
        cf = ConfigParser.ConfigParser()  
        cf.read(file_path)
        url_path = cf.get("api_config", "url")  
        api_key = cf.get("api_config", "apikey")  
        sec_Key = cf.get("api_config", "secKey")  
        #print db_host, db_port, db_user, db_pwd 
    def get_url_path(self):
        return url_path
    
    def get_api_key(self):
        return api_key
    
    def get_sec_Key(self):
        return sec_Key
    